import json
# # # load针对文件句柄，将json格式的字符转换为dict，从文件中读取 (将string转换为dict)
# a_json = json.load(open('demo.json','r'))
# print(a_json)
# print(type(a_json))
#
# # loads：针对内存对象，将string转换为dict (将string转换为dict)
# hbq = '{"daozhang":"ddd","xusheng": "xxx"}'
# print(hbq)
# print(type(hbq))
# kk = json.loads(hbq)
# print(type(kk))

#dump：将dict类型转换为json字符串格式，写入到文件 （易存储）
hbq = {"daozhang":"ddd","xusheng": "xxx"}
print(type(hbq))
kkk = json.dump(hbq,open('demo.json','w'))
print(kkk)
print(type(kkk))

# # dumps：将dict转换为string (易传输)
# hbq = {"daozhang":"ddd","xusheng": "xxx"}
# print(type(hbq))
# kkk = json.dumps(hbq)
# print(type(kkk))
